<template>
	<el-row>
		<el-col class="top">
			<label>快速查询近三天患者信息</label>
		</el-col>
		<el-col :span="10" :offset="7">
			<div style="margin-top: 15px;">
				<el-input placeholder="请输入内容" v-model="searchWords" class="input-with-select">
			    <el-select v-model="searchType" slot="prepend" placeholder="请选择" style="width:110px;">
			      <el-option label="患者姓名" value="byName"></el-option>
			      <el-option label="就诊卡号" value="byCard"></el-option>
			      <el-option label="手机号码" value="byPhone"></el-option>
			    </el-select>
			    <el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button>
			  </el-input>
			</div>
		</el-col>
		<el-col :span="22" :offset="1" class="resultContent">
			<el-collapse v-model="activeNames">
			  <el-collapse-item :name="index" v-for="(item,index) in resultList" :key="index">
			  	<template slot="title" class="title">
			      <el-row class="titleInfo">
			      	<el-col :span="2">
			      		<label>#{{index+1}}/{{resultList.length}}</label>
			      	</el-col>
			      	<el-col :span="3">
			      		<label>状态：</label>{{item.status=="1"?"已归档":(item.complaintName?"检查中":"待诊中")}}
			      	</el-col>
			      	<el-col :span="4">
			      		<label>就诊卡号：</label>{{item.recordCard}}
			      	</el-col>
			      	<el-col :span="3">
			      		<label>姓名：</label>
				      	<router-link :to="'/caseDetail/'+item.recordUUID" target="_blank">
						{{item.recordName}}
						</router-link>
			      	</el-col>
			      	<el-col :span="2">
			      		<label>性别：</label>{{item.recordSex}}
			      	</el-col>
			      	<el-col :span="2">
			      		<label>年龄：</label>{{item.recordAge}}
			      	</el-col>
			      	<el-col :span="3">
			      		<label>去向：</label>{{item.sendDept}}
			      	</el-col>
			      </el-row>
			    </template>
			    <el-row class="expandInfo">
			    	<el-col :span="5">
			    		<label>就诊时间：</label>{{item.startTime}}
			    	</el-col>
			    	<el-col :span="4">
			    		<label>联系电话：</label>{{item.recordTel}}
			    	</el-col>
			    	<el-col :span="15">
			    		<label>联系地址：</label>{{item.recordAddress}}
			    	</el-col>
			    	<el-col :span="5">
			    		<label>处置医生：</label>{{item.doctor}}
			    	</el-col>
			    	<el-col :span="4">
			    		<label>分诊护士：</label>{{item.nurse}}
			    	</el-col>
			    	<el-col :span="5">
			    		<label>治疗科室：</label>{{item.sendDept}}
			    	</el-col>
			    	<el-col :span="5">
			    		<router-link :to="'/caseDetail/'+item.recordUUID" target="_blank">
						查看病历详情
						</router-link>
			    	</el-col>
			    </el-row>
			  </el-collapse-item>
			</el-collapse>
		</el-col>
	</el-row>
</template>
<script type="text/javascript">
	export default{
		name:'SearchMain',
		data(){
			return{
				curUser:{},
				searchWords:'',
				searchType:'byName',
				activeNames: [],
				resultList:[]
			}
		},
		mounted(){
			if (this.$cookies.get("curUser")) {
				this.curUser = this.$cookies.get("curUser");
			}
		},
		methods: {
	      handleSearch:function() {
	      	let vm = this;
	        if (vm.searchWords) {
		        vm.$axios.searchRecords(vm.curUser.hospitalCode,vm.searchWords,vm.searchType).then(function(res){
		        	vm.resultList = [];
		        	if (res.data&&res.data.data) {
		        		vm.resultList = res.data.data;
		        	}
		        });
	        }else{
	        	vm.$notify({
				          title: '操作提示',
				          message: "查询内容不能为空",
				          type: 'warning'
				        });
	        }
	      }
	    }
	}
</script>
<style type="text/css" scoped>
	.top{
		font-weight: bolder;
		line-height: 45px;
		height: 45px;
		border-bottom: 1px dashed #eeeeee;
	}
	.resultContent{
		text-align: left;
		margin-top: 35px;
	}
	.resultContent label{
		font-weight: bolder;
	}
	.expandInfo{
		line-height: 45px;
		padding-left: 15px;
	}
	.titleInfo{
		padding-left: 15px;
		background-color: #F5FFFA;
	}
</style>